// Prepare Figure 5 //


clear all
clear matrix
set more off

// Load Panel dataset
use "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/panel_excombatientes.dta", clear 

// Model with Nmonths = 12
eststo clear
set more off

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r if Nmonthsingroup >= 12, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo store_model

// Export coefficients and standard errors to a .csv file using esttab
esttab store_model using "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/estimation_results_A4.csv", cells("b ci") noabbrev noobs ///
  rename(_nl_1 12_months)    replace

// Model with Nmonths = 18
eststo clear
set more off

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r if Nmonthsingroup >= 18, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo store_model_18

// Export coefficients and standard errors to a .csv file using esttab
esttab store_model_18 using "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/estimation_results_A4.csv", cells("b ci") noabbrev noobs ///
    rename(_nl_1 18_months)  nomtitles append

// Model with Nmonths = 24
eststo clear
set more off

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r if Nmonthsingroup >= 24, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo store_model_24

// Export coefficients and standard errors to a .csv file using esttab
esttab store_model_24 using "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/estimation_results_A4.csv", cells("b ci") noabbrev noobs ///
    rename(_nl_1 24_months)  nomtitles append
	
// Model with Nmonths = 30
eststo clear
set more off

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r if Nmonthsingroup >= 30, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo store_model_30

// Export coefficients and standard errors to a .csv file using esttab
esttab store_model_30 using "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/estimation_results_A4.csv", cells("b ci") noabbrev noobs ///
  rename(_nl_1 30_months) nomtitles append


// Model with Nmonths = 36
eststo clear
set more off

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r if Nmonthsingroup >= 36, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo store_model_36

// Export coefficients and standard errors to a .csv file using esttab
esttab store_model_36 using "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/estimation_results_A4.csv", cells("b ci") noabbrev noobs ///
    rename(_nl_1 36_months) nomtitles append

// Model with Nmonths = 42
eststo clear
set more off

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r if Nmonthsingroup >= 42, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo store_model_42

// Export coefficients and standard errors to a .csv file using esttab
esttab store_model_42 using "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/estimation_results_A4.csv", cells("b ci") noabbrev noobs ///
    rename(_nl_1 42_months) nomtitles append


// Model with Nmonths = 48

eststo clear
set more off

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r  if Nmonthsingroup >= 48, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo store_model_48

// Export coefficients and standard errors to a .csv file using esttab
esttab store_model_48 using "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/estimation_results_A4.csv", cells("b ci") noabbrev noobs ///
    rename(_nl_1 48_months) nomtitles append


// Model with Nmonths = 54

eststo clear
set more off

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r if Nmonthsingroup >= 54, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo store_model_54

// Export coefficients and standard errors to a .csv file using esttab
esttab store_model_54 using "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/estimation_results_A4.csv", cells("b ci") noabbrev noobs ///
   rename(_nl_1 54_months) nomtitles append

// Model with Nmonths = 60

eststo clear
set more off

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r if Nmonthsingroup >= 60, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo store_model_60

// Export coefficients and standard errors to a .csv file using esttab
esttab store_model_60 using "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/estimation_results_A4.csv", cells("b ci") noabbrev noobs ///
    rename(_nl_1 60_months) nomtitles append

